﻿@model IEnumerable<PsCommand>

@{
    ViewBag.Title = "ข้อมูลคำสั่งให้ออกจากราชการ";
}

<div style="padding: 0 100px;">
<h2>ข้อมูลคำสั่งให้ออกจากราชการ</h2>

<h4><img src="~/Images/Icons/add.png" height="14"> @Html.ActionLink("สร้างคำสั่งใหม่", "Create")</h4>

<table class="tablesorter">
    <thead>
    <tr>
        <th width="70px">
            @Html.DisplayNameFor(model => model.CmdName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CmdDescr)
        </th>
        <th width="70px">
            @Html.DisplayNameFor(model => model.CmdRefNo)
        </th>
        <th width="70px">
            @Html.DisplayNameFor(model => model.CmdTypeId)
        </th>
        <th width="70px">
            @Html.DisplayNameFor(model => model.CmdStatus)
        </th>
        <th width="70px">
            @Html.DisplayNameFor(model => model.ApprovedName)
        </th>
        <th width="70px">
            @Html.DisplayNameFor(model => model.ApprovedDate)
        </th>
        <th width="150px">

        </th>
    </tr>
    </thead>
    <tbody>
@foreach (var item in Model) {
    <tr>
        <td width="70px">
            @Html.DisplayFor(modelItem => item.CmdName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CmdDescr)
        </td>
        <td width="70px">
            @Html.DisplayFor(modelItem => item.CmdRefNo)
        </td>
        <td width="70px">
            @Html.DisplayFor(modelItem => item.HrmPsCommandTypes.CmdTypeName)
        </td>
        <td width="70px">
            @item.GetCmdStatusName
        </td>
        <td width="70px">
            @Html.DisplayFor(modelItem => item.ApprovedName)
        </td>
        <td width="70px">
            @Html.DisplayFor(modelItem => item.ApprovedDate)
        </td>
        <td width="150px">
            @if(item.RecordStatus != "A")
            {
            @Html.ActionLink("แก้ไข", "Edit", new { id=item.CmdId })@Html.Raw("&nbsp;|")
            }
            @Html.ActionLink("รายละเอียด", "Details", new { id=item.CmdId })

            @if(item.RecordStatus != "A")
            {@Html.Raw("|&nbsp;")
            @Html.ActionLink("ลบ", "Delete", new { id=item.CmdId, model = @Model })
            }
        </td>
    </tr>
}
    </tbody>

</table>

<div id="pager">
    <form>
    <img src="@Url.Content("~/Images/Icons/first.png")" class="first" />
    <img src="@Url.Content("~/Images/Icons/prev.png")" class="prev" />
    <input type="text" class="pagedisplay" />
    <img src="@Url.Content("~/Images/Icons/play.png")" class="next" />
    <img src="@Url.Content("~/Images/Icons/last.png")" class="last" />
    <select class="pagesize">
        <option selected="selected" value="10">10</option>
        <option value="20">20</option>
        <option value="30">30</option>
        <option value="40">40</option>
    </select>
    </form>
</div>
</div>

@section scripts{    

    <script type="text/javascript">

        jQuery(function ($) {
            $("table.tablesorter").tablesorter({ widthFixed: true, sortList: [[0, 0]], widgets: ["zebra", "filter"] })
                .tablesorterPager({ container: $("#pager"), size: $(".pagesize option:selected").val() });
        });
    </script>
}